package com.fs.consumer;

import com.fs.entity.Demo01Message;
import lombok.extern.log4j.Log4j2;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * @author ：hyq
 * @date ：Created in 2020/5/21 17:27
 * @description：
 * @modified By：
 */
@Component
@RocketMQMessageListener(
        topic = Demo01Message.TOPIC,
        consumerGroup = "demo01-consumer-group-" + Demo01Message.TOPIC,
//        messageModel = MessageModel.BROADCASTING, // 设置为广播消费
        consumeMode = ConsumeMode.ORDERLY // 设置为顺序消费
)
@Log4j2
public class Demo01Consumer implements RocketMQListener<Demo01Message> {


    @Override
    public void onMessage(Demo01Message message) {
        log.info("[onMessage][线程编号:{} 消息内容：{}]", Thread.currentThread().getId(), message);
    }

}
